#!/bin/bash 
#to recover data from obs with specify date,the last two parameters is vhostname and es's indexname,if not assignment,it will use the resource/conf.properties parameters in the jar
#从obs中指定时间段恢复es中的数据，用于es中数据丢失恢复
startdate="$1"
date1=$(date -d "$1" "+%s") 
date2=$(date -d "$2" "+%s") 
date_count=$(echo "$date2 - $date1"|bc) 
day_m=$(echo "$date_count"/86400|bc) 
for ((sdate=0;sdate<"$day_m";sdate++)) 
do
        month=$(date -d "$startdate $sdate days" "+%m")
	day=$(date -d "$startdate $sdate days" "+%d")
	/opt/client/Spark/spark/bin/spark-submit --class com.huawei.opensourway.AnalysisForBatch --num-executors 1 --executor-cores 6 --master yarn-cluster /root/om-bigdata-1.0-SNAPSHOT.jar GJK7VGQW4KI5MBSMOE2Q Dim9rM3uivK1gFv7gBGT80G7oLWpOt2JTPTjBFeY 6 obs://om-collect/logstash-2020.$month.$day-hk-app.json repo.openeuler.org openeuler_download_20200824
	echo $month $day have done
done
